/**
   ******************************************************************************
   * File   : TMR/TMR_6Steps/at32f4xx_it.c
  * Version: V1.1.9
  * Date   : 2020-05-29
   * Brief  : Main Interrupt Service Routines.
   *          This file provides template for all exceptions handler and peripherals
  *          interrupt service routine.
  ******************************************************************************
  */ 
/**
 **************************************************************************
 * File   : at32f4xx_it.c
  * Version: V1.1.9
  * Date   : 2020-05-29
 * Brief  : at32f4xx interrupt service routines.
 **************************************************************************
 */


/* Includes ------------------------------------------------------------------*/
#include "at32f4xx_it.h"

/** @addtogroup AT32F403A_StdPeriph_Examples
  * @{
  */
  
/** @addtogroup TMR_6Steps
  * @{
  */ 

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
__IO uint32_t step = 1;

/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/**
  * @brief  This function handles NMI exception.
  * @param  None
  * @retval None
  */
void NMI_Handler(void)
{
}



/**
  * @brief  This function handles Memory Manage exception.
  * @param  None
  * @retval None
  */
void MemManage_Handler(void)
{
  /* Go to infinite loop when Memory Manage exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Bus Fault exception.
  * @param  None
  * @retval None
  */
void BusFault_Handler(void)
{
  /* Go to infinite loop when Bus Fault exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Usage Fault exception.
  * @param  None
  * @retval None
  */
void UsageFault_Handler(void)
{
  /* Go to infinite loop when Usage Fault exception occurs */
  while (1)
  {}
}

/**
  * @brief  This function handles Debug Monitor exception.
  * @param  None
  * @retval None
  */
void DebugMon_Handler(void)
{}




/******************************************************************************/
/*            AT32F403A Peripherals Interrupt Handlers                        */
/******************************************************************************/

/**
  * @brief  This function handles TMR6 Trigger and commutation interrupts
  *   requests.
  * @param  None
  * @retval None
  */
  extern uint16_t time;
void TMR6_GLOBAL_IRQHandler (void)
{
			if(TMR_GetINTStatus(TMR6,TMR_INT_Overflow)!=RESET)
		{
				time++;
				TMR_ClearITPendingBit(TMR6,TMR_INT_Overflow);
		}
}

void USART1_IRQHandler(void)
{
  uint8_t i=0;
		  if(USART_GetFlagStatus(USART1,USART_INT_RDNE)==SET)
			 {
				  if(USART_ReceiveData(USART1)=='\n' ||USART_ReceiveData(USART1)=='\0')
				  {
						  sp=0;
						  USART_Finish_FLAG=1;
						  for(i=0;i<REVBUFFSIZE;i++)
							  {
								  RecBuffer[i]='\0';
							  }
				  
				  }
				  else
				  {
						  if(sp==0)
						  {
							  for(i=0;i<REVBUFFSIZE;i++)
							  //SendData[i]='\0';
							  RecBuffer[i]='\0';
						  }
						  RecBuffer[sp]=USART_ReceiveData(USART1);
						  sp++;
				  }
			  }
		  if(USART_GetITStatus(USART1,USART_INT_RDNE)!=RESET)
		  {
				  USART_ClearITPendingBit(USART1,USART_INT_RDNE);
		  }

}

/**
  * @}
  */ 

/**
  * @}
  */ 

/******************* (C) COPYRIGHT 2018 ArteryTek *****END OF FILE****/

